namespace Jumpton.SFA.Server.Entity
{
    using System;
    using System.Collections.Generic;
    using System.Text;
    using Jumpton.Persistent;
    using System.Data;
    using System.Runtime.Serialization;
    
    
    [System.SerializableAttribute()]
    [RelationMap("VISITS", typeof(VISITS), "V")]
    [Relation(RelationJoinType.Inner, typeof(CUSTOMERS), "C", "V", "ID", "CUSTOMER_ID")]
   
    public class VISITS_ROUTE_VIEW : ObjectRow {
        
        public VISITS_ROUTE_VIEW() {
        }
        //[RelationMap("ROUTE_CUSTOMERS", typeof(ROUTE_CUSTOMERS), "RC")]
        //[Relation(RelationJoinType.Inner, typeof(CONTACT_INFO), "CI", "RC", "CUSTOMER_ID", "CUSTOMER_ID")]
        //[Relation(RelationJoinType.Inner, typeof(CUSTOMERS), "C", "CI", "ID", "CUSTOMER_ID")]
        /// <summary>
        /// 构造函数
        /// </summary>
        /// <param name="dataRow">DataTable 中的一行数据</param>
        /// <param name="objectTable">存储当前对象的数据表格</param>
        public VISITS_ROUTE_VIEW(System.Data.DataRow dataRow, ObjectTable parent) : 
                base(dataRow, parent) {
        }
        
        /// <summary>
        /// 供反序列化使用的构造函数
        /// </summary>
        /// <param name="info"></param>
        /// <param name="context"></param>
        protected VISITS_ROUTE_VIEW(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) : 
                base(info, context) {
        }
        
        [Key("ID", TableAlias = "V")]
        public decimal ID {
            get {
                return (System.Decimal)GetValue("ID");
            }
            set {
                SetValue("ID", value);
            }
        }
        [Field("USER_ID", TableAlias = "V")]
        public decimal USERID
        {
            get
            {
                return (System.Decimal)GetValue("USERID");
            }
            set
            {
                SetValue("USERID", value);
            }
        }
        [Field("CUSTOMER_ID", TableAlias = "V")]
        public decimal CUSTOMERID
        {
            get {
                return (System.Decimal)GetValue("CUSTOMERID");
            }
            set {
                SetValue("CUSTOMERID", value);
            }
        }

        [Field("START_TIME", TableAlias = "V")]
        public decimal STARTTIME
        {
            get
            {
                return (System.Decimal)GetValue("STARTTIME");
            }
            set
            {
                SetValue("STARTTIME", value);
            }
        }
      
        [Field("STOP_TIME", TableAlias = "V")]
        public decimal STOPTIME
        {
            get
            {
                return (System.Decimal)GetValue("STOPTIME");
            }
            set
            {
                SetValue("STOPTIME", value);
            }
        }

        [Field("VISIT_TYPE", TableAlias = "V")]
        public string VISITTYPE
        {
            get
            {
                return (System.String)GetValue("VISITTYPE");
            }
            set
            {
                SetValue("VISITTYPE", value);
            }
        }

       

        [Field("OUTLINE", TableAlias = "V")]
        public bool OUTLINE
        {
            get
            {
                return (System.Boolean)GetValue("OUTLINE");
            }
            set
            {
                SetValue("OUTLINE", value);
            }
        }

        [Field("STATUS", TableAlias = "V")]
        public string STATUS
        {
            get
            {
                return (System.String)GetValue("STATUS");
            }
            set
            {
                SetValue("STATUS", value);
            }
        }

        [Field("NAME", TableAlias = "C")]
        public string NAME
        {
            get
            {
                return (System.String)GetValue("NAME");
            }
            set
            {
                SetValue("NAME", value);
            }
        }

        
        /// <summary>
        /// 拜访记录纬度
        /// </summary>
        [Field("LONGITUDE", TableAlias = "V")]
        public double LONGITUDE
        {
            get
            {
                try
                {
                    double longitude= (System.Double)GetValue("LONGITUDE");
                    if (longitude == 0)
                        longitude = IDENTITY1;
                    return longitude;
                }
                catch { return IDENTITY1; }
            }
            set
            {
                SetValue("LONGITUDE", value);
            }
        }

        /// <summary>
        /// 拜访记录经度
        /// </summary>
        [Field("LATITUDE", TableAlias = "V")]
        public double LATITUDE
        {
            get
            {
                try
                {
                    double latitude= (System.Double)GetValue("LATITUDE");
                    if (latitude == 0)
                        latitude = IDENTITY2;
                    return latitude;
                }
                catch { return IDENTITY2; }
            }
            set
            {
                SetValue("LATITUDE", value);
            }
        }

        /// <summary>
        /// 门店纬度
        /// </summary>
        [Field("IDENTITY1", TableAlias = "C")]
        public double IDENTITY1
        {
            get
            {
                try
                {
                    return (System.Double)GetValue("IDENTITY1");
                }
                catch { return 0; }
            }
            set
            {
                SetValue("IDENTITY1", value);
            }
        }

        /// <summary>
        /// 门店经度
        /// </summary>
        [Field("IDENTITY2", TableAlias = "C")]
        public double IDENTITY2
        {
            get
            {
                try
                {
                    return (System.Double)GetValue("IDENTITY2");
                }
                catch { return 0; }
            }
            set
            {
                SetValue("IDENTITY2", value);
            }
        }
        
    }
}
